/*
 * Copyright:  2018 smarabbit studio.
 *
 *  Licensed under the Confluent Community License; you may not use this file
 *  except in compliance with the License.  You may obtain a copy of the License at
 *
 *  http://www.confluent.io/confluent-community-license
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 *  WARRANTIES OF ANY KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations under the License.
 *
 *  @作   者： 黄开晖 (117227773@qq.com)
 *  @日   期:  2021年5月23日
 */
package com.massyframework.beanskin.assembly.beans;

/**
 * 添加Bean, 但同名Bean已经存在时抛出的例外
 * @author huangkh
 *
 */
public class BeanExistsException extends BeansException {

	/**
	 * 
	 */
	private static final long serialVersionUID = -6102826240880482570L;

	private final String beanName;

	/**
	 * 根据{@code beanName}创建{@link BeanExistsException}实例
	 * @param beanName {@link String}, bean名称
	 */
	public BeanExistsException(String beanName) {
		super("bean with the same name already exists: beanName= \"".concat(beanName).concat("\"."));
		this.beanName = beanName;
	}

	/**
	 * bean名称
	 * @return {@link String}
	 */
	public String getBeanName() {
		return this.beanName;
	}

	@Override
	public String toString() {
		return "BeanExistsException [beanName=" + beanName + "]";
	}

}
